$(document).ready(function(){
	$("#resultScore").click(function(){
		var q1 = parseInt($("input[name='q1']:checked").val());
		var q2 = parseInt($("input[name='q2']:checked").val());
		var q3 = parseInt($("input[name='q3']:checked").val());
		var q4 = parseInt($("input[name='q4']:checked").val());
		var q5 = parseInt($("input[name='q5']:checked").val());
		var q6 = parseInt($("input[name='q6']:checked").val());
		var q7 = parseInt($("input[name='q7']:checked").val());
		var q8 = parseInt($("input[name='q8']:checked").val());
		var q9 = parseInt($("input[name='q9']:checked").val());
		var q10 = parseInt($("input[name='q10']:checked").val());
		var sum;
	
		sum = q1 + q2 + q3 + q4 + q5 + q6 + q7 + q8 + q9 + q10;
		 
		if(100>=sum && sum>=80){ 
			//alert(sum+"점 : 와우~ 너무도 잘 알고 있는 스마트한 당신! 앞으로도 윤리경영실천에 더욱 앞장서 주세요."); 
			$("#dialogPop")
				.css({
						position:'absolute',
						left: ($(window).width() - $("#dialogPop").outerWidth()) / 2,
						top: ($(document).height() + $(document).scrollTop() - $("#dialogPop").outerHeight()) / 2,
						display: ''
					});
			//$("#pop_txt").html("<span><font size=6 color='red'><Strong>" + sum + "</Strong></font></span> <img src='/images/ethic/popup_img.gif'/>");
			//$("#pop_txt").html(sum + "<img src='/images/ethic/popup_img.gif'/>");
			$("#dialogPop").html("<div id='popup'><div class='pop_box'><dl class='pop_txt'><dd class='pop_txt2'>" + sum + "</dd><dd class='pop_txt3'><img src='/images/ethic/popup_img.gif'/></dd></dl>" +
			"<dl class='pop_img'><img src='/images/ethic/popup_best.gif'/></dd></dl></div></div>");
		} else if(70>=sum && sum >=40) { 
			$("#dialogPop")
			.css({
					position:'absolute',
					left: ($(window).width() - $("#dialogPop").outerWidth()) / 2,
					top: ($(document).height() + $(document).scrollTop() - $("#dialogPop").outerHeight()) / 2,
					display: ''
				});
			/*alert(sum+"점 : 나쁘지는 않지만 한 번 더 생각해보면 어떨까요? 그렇다면 당신의 윤리의식은 UP! UP! UP!");*/ 
			$("#dialogPop").html("<div id='popup'><dlv class='pop_box'><dl class='middle_txt'><dd class='middle_txt2'>" + sum + "</dd><dd class='pop_txt3'><img src='/images/ethic/popup_img.gif'/></dd></dl>" +
			"<dl class='middle_img'><dd class='middle_img2'><img src='/images/ethic/popup_middle.gif' width='252' height='98'/></dd></dl></div></div>");
		} else if(30>=sum && sum >=0) { 
			$("#dialogPop")
			.css({
					position:'absolute',
					left: ($(window).width() - $("#dialogPop").outerWidth()) / 2,
					top: ($(document).height() + $(document).scrollTop() - $("#dialogPop").outerHeight()) / 2,
					display: ''
				});
			/*alert(sum+"점 : 안돼요! 안돼! 윤리적 위기상태입니다 윤리경영실천! 생각보다 어렵지 않아요~ 시작이 반입니다.  작은 것부터 바꿔보세요");*/
			$("#dialogPop").html("<div id='popup'><div class='pop_box'><dl class='down_txt'><dd class='down_txt2'>" + sum + "</dd><dd class='pop_txt3'><img src='/images/ethic/popup_img.gif'/></dd></dl>" +
			"<dl class='down_img'><dd class ='down_img2'><img src='/images/ethic/popup_down.gif' width='252' height='98'/></dd></dl></div></div>");
		} else {
			alert("모든 질문에 답변해 주셔야 합니다.");
		}
		
	});
	$("#dialogPop").click(function(){
		$("#dialogPop").css('display', 'none');
	});
});
